trigger DeleteHCPERecord on HCPEducation__c (before delete) {
    if(system.trigger.isdelete){
        Profile p  = [select id from profile where name=: 'System Administrator' or name =: '系统管理员']; 
        for (HCPEducation__c hcp : Trigger.old)
        {
            if((hcp.ownerid != UserInfo.getUserId())&&(p.id != UserInfo.getProfileId()) && hcp.deleteMark__c==false){
                hcp.addError('您无权删除该计划!');
            }
            if((hcp.date__c <= Date.Today())&&(p.id != UserInfo.getProfileId())&& hcp.deleteMark__c==false){
                hcp.addError('该记录不能被删除!');
            }
        }
    }
}